package com.sondon.mayi.util;

import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;

public class AsyncHttpUtil {
	/**
	 * 单例
	 */
	private final static AsyncHttpClient httpclient = new AsyncHttpClient();

	private AsyncHttpUtil() {

	}

	private static AsyncHttpClient getHttpClient() {
		return httpclient;
	}

	public static void get(String url, RequestParams params,
			AsyncHttpResponseHandler responseHandler) {
		getHttpClient().get(url, params, responseHandler);
	}

	public static void post(String url, RequestParams params,
			AsyncHttpResponseHandler responseHandler) {
		getHttpClient().post(url, params, responseHandler);
	}
	
	
	/**
	 * RequestParams的参数和值同名
	 * @param strs
	 * @return
	 */
	public static RequestParams SetParams(String... strs){
		RequestParams params=new RequestParams();
		for(String param:strs){
			params.put(param, param);
		}
		return params;
	}

}